package com.demo.demos.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.demo.demos.entity.User;
import com.demo.demos.service.UserService;
import com.demo.demos.mapper.UserMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;

/**
* @author Lenovo
* @description 针对表【user】的数据库操作Service实现
* @createDate 2025-02-28 15:19:06
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService{

    @Resource
    private UserMapper userMapper;

    @Override
    public Page<User> pageSearch(Integer pageNo, Integer pageSize,String name) {
        Page<User> page = new Page<>(pageNo, pageSize);
        QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
        userQueryWrapper.eq(!StringUtils.isEmpty(name),"name",name);
        return userMapper.selectPage(page, userQueryWrapper);
    }
}




